<?php


namespace App\Models;

class HouseModel extends Base
{

    protected $table = 'house';

    protected $primaryKey = 'h_id';

    public $timestamps = false;

    protected $fillable = [
        'estate_id', 'c_id', 'house_num'
    ];

    /**
     * Notes: 关联小区
     * User: lstink
     * Date: 2021/2/2
     * Time: 5:17 下午
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function community()
    {
        return $this->belongsTo(Community::class, 'c_id', 'community_id');
    }

    /**
     * Notes: 关联物业
     * User: lstink
     * Date: 2021/2/2
     * Time: 5:17 下午
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function estate()
    {
        return $this->belongsTo(Property::class, 'estate_id', 'id');
    }

    /**
     * Notes: 关联单元
     * User: lstink
     * Date: 2021/2/2
     * Time: 5:24 下午
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function element()
    {
        return $this->hasMany(ElementModel::class, 'h_id', 'h_id');
    }



}
